hpxAdminApp.factory('custserService', ['Restangular', function (Restangular) {
    var res = Restangular.all('custser');
    return {
        get: function (id) {
            return res.one(id).get();
        },
        searchCustserList: function (params, custser_name,custser_phone,custser_group,is_online) {
            var queryParam = {
                'p': params.page(),
                'n': params.count(),
                'custserName': custser_name,
                'custserPhone': custser_phone,
                'custserGroup': custser_group,
                'isOnline': is_online
            }

            return res.get('custsers', queryParam).then(function (result) {
                params.total(result.page_info.items_number);
                return result.custser_list;
            });
        },
       

        add: function (model) {
            return res.all('custsers').post(model);
        },
        update: function (model) {
            return res.one('custsers', model.id).customPUT(model);
        },
        remove: function (id) {
            return res.all('custsers').customDELETE(id);
        },
       
    }
}]);
